export const errorResponserHandler = (err, req, res, next) => {
    const statusCode = err.statusCode || 400;
    res.status(statusCode).json({
        message: err.message,
        stack: process.env.NODE_ENV === 'production' ? null : err.stack, // stack trace is only available in development mode
    })
}

export const invalidPathHandler = (req, res, next) => {
    let error = new Error('Invalid path');
    error.statusCode = 404;
    next(error);
}